<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" style="height: 100%;padding: 0;margin: 0;"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
<head>
    <title>城市管理</title>
    <meta charset="UTF-8"/>
    <link rel="stylesheet" type="text/css" th:href="@{/easyui/themes/default/easyui.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/easyui/themes/icon.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/easyui/demo/demo.css}"/>
    <script type="text/javascript" th:src="@{/easyui/jquery.min.js}"></script>
    <script type="text/javascript" th:src="@{/easyui/jquery.easyui.min.js}"></script>
    <script type="text/javascript" th:src="@{/easyui/locale/easyui-lang-zh_CN.js}"></script>
</head>
<body style="height: 100%;width: 100%;padding: 0;margin: 0;">
<div style="margin-bottom:10px;margin-top: 10px;padding-left: 10px;height: 4%;">
    <span>省份:</span>
    <select id="provinceListId" class="easyui-combobox" style="width:100px">
        <option value="">未选择</option>
        <option th:each="province : ${provinceList}" th:value="${province.code}" th:text="${province.name}"></option>
    </select>
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" onclick="loadData()">查询</a>
</div>
<table id="tt" title="城市列表" style="width:100%;height:94%;"
       data-options="toolbar:toolbar,rownumbers:true,singleSelect:true,pagination:true,url:'/t/city/list',method:'post'">
    <thead>
    <tr>
        <th field="id" checkbox="true"></th>
        <th field="code" width="32%">城市编码</th>
        <th field="name" width="33%">城市名称</th>
        <th field="pname" width="33%">所属省份</th>
    </tr>
    </thead>
</table>

<script type="text/javascript">
    $(function () {
        var pager = $('#tt').datagrid().datagrid('getPager');
    });
    var toolbar = [];
    toolbar.push('-', {
        text: '刷新',
        iconCls: 'icon-reload',
        handler: reloads
    });

    function reloads() {
        $('#tt').datagrid('reload');//刷新
    }
    
    function loadData() {
        $('#tt').datagrid('load',{
            pcode: $('#provinceListId').combobox('getValue')
        });
    }
</script>
</body>
</html>